;;; +flycheck.el --- Initialization and mode setting.

;;; Homepage:
;; https://github.com/flycheck/flycheck

;;; Commentary:
;; Syntax checking on the fly.

;;; Code:

(use-package flycheck
  :ensure
  :hook
  (prog-mode . flycheck-mode)
  :init
  (setq flycheck-check-syntax-automatically '(idle-buffer-switch
					      mode-enabled
					      idle-change
					      new-line
					      save)
	flycheck-mode-line-prefix "FlyCheck"
	flycheck-idle-buffer-switch-delay 0
	flycheck-display-errors-delay 0
	flycheck-idle-change-delay 1
	flycheck-indication-mode nil)
  :config
  (if (display-graphic-p)
      (progn
	(set-face-attribute 'flycheck-warning nil :underline `(:color ,(face-attribute 'warning :foreground) :style line))
	(set-face-attribute 'flycheck-info nil :underline `(:color ,(face-attribute 'success :foreground) :style line))
	(set-face-attribute 'flycheck-error nil :underline `(:color ,(face-attribute 'error :foreground) :style line)))
    (progn
      (set-face-attribute 'flycheck-warning nil :foreground (face-attribute 'warning :foreground))
      (set-face-attribute 'flycheck-info nil :foreground (face-attribute 'success :foreground))
      (set-face-attribute 'flycheck-error nil :foreground (face-attribute 'error :foreground)))))

(provide '+flycheck)

;;; +flycheck.el ends here
